
<script >
	function addElement() {

	  var ni = document.getElementById('myDiv');

	  var numi = document.getElementById('theValue');

	  var num = (document.getElementById('theValue').value -1)+ 2;

	  numi.value = num;

	  var newdiv = document.createElement('div');

	  var divIdName = 'my'+num+'Div';

	  newdiv.setAttribute('id',divIdName);
	  newdiv.setAttribute('style','float:left; width:100%');

	  newdiv.innerHTML = '<p><input type="hidden" id="userfile'+num+'" name="sanpham_hinhanh'+num+'" value=""/><img src="" width="50" id="imgdef'+num+'" name="imgdef'+num+'" height="40" style="float:left; border:#CCC 1px solid" /><input type="button" name="button3" value="Up file đính kèm" onclick="JavaScript:window.open(\'Upfile.php?Dir=sanpham&amp;form=userfile'+num+'&img=imgdef'+num+'\',\'_upLoad\' ,\'height=220,width=450,resizable=no,scrollbars=yes\')") />&nbsp; <a href="javascript:;" onclick="removeElement(\''+divIdName+'\');">Xóa</a></p>';

	  ni.appendChild(newdiv);

	}
	function removeElement(divNum) {

	  var vl = document.getElementById('theValue');
	  vl.value= vl.value-1;
	  var d = document.getElementById('myDiv');

	  var olddiv = document.getElementById(divNum);

	  d.removeChild(olddiv);

	}
</script>
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">

	// O2k7 skin
tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		width : "700",
		height : "300",
		skin : "o2k7",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist,autosave,visualblocks",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,sub,sup,link,unlink,formatselect,fontselect,fontsizeselect,forecolor,backcolor",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		theme_advanced_buttons4 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		theme_advanced_path : false, 
		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		

	});
				
/* Default skin */



</script>

<script language="javascript">
function validate_form(thisform)
{
with (thisform)
{
	
	
	if (validate_required(tiendo,"Bạn chưa chọn tiến độ công việc !")==false)
 	{tiendo.focus();return false;}
	
}
}
</script>



<?php 
$soanh=1;
?>
<?php 
	$id=$_GET['id'];
	$sql=mysql_query("
						select * 
						from 
							register
							inner join tb_task on register.task_id=tb_task.task_id
						where register.task_id='$id'
						
					");
	$row=mysql_fetch_array($sql);
?>
 <table class="box-vang5" cellpadding="0" cellspacing="0" width="100%">
        <tbody><tr class="light">
          <td class="text-top">.:. Báo cáo công việc</td>
        </tr>
      </tbody></table>
      <table class="box-vang5" cellpadding="0" cellspacing="0" width="100%">
        <tbody><tr class="light">
          <td class="t-l"></td>
          <td class="t-c"></td>
          <td class="t-r"></td>
        </tr>
        <tr class="light">
          <td class="c-l"></td>
          <td class="c-c" valign="top">
          	<form action="index.php?tn=xuly_report&id=<?php echo $id;?>" onsubmit="return validate_form(this);" name="frmAddMessage" id="theform" method="post" enctype="multipart/form-data">
              <table border="0" cellpadding="0" cellspacing="0" height="10" width="100%">
                <tbody><tr class="light">
                  <td><img src="index2.php_files/spaces.gif" height="1" width="1"></td>
                </tr>
              </tbody></table>
              <table class="font_11" border="0" cellpadding="5" cellspacing="0" width="100%">
                <tbody>
          <tr class="light" id="tieudeyeucau" onmouseover="mouse_den(this)" onmouseout="mouse_di(this)">
                  <td id="tieudeyeucau1" class="tdbg_2"><span><strong>Tên công việc</strong><span class="color_khancap"></span></span></td>
                  <td id="tieudeyeucau2" class="tdbg_2">:</td>
                  <td id="tieudeyeucau3" class="tdbg_2" style="color:#666; font-size:12px;"><strong><input type="text" name="name_task" value="<?php echo $row['task_name'];?>" readonly="readonly" style="width:720px;"/></strong></td>
                </tr>
               
                 <tr class="light" id="tieudeyeucau" onmouseover="mouse_den(this)" onmouseout="mouse_di(this)">
                  <td id="tieudeyeucau1" class="tdbg_2"><span><strong>Ngày Báo Cáo</strong><span class="color_khancap"></span></span></td>
                  <td id="tieudeyeucau21" class="tdbg_2">:</td>
                  <td id="tieudeyeucau31" class="tdbg_2">
                  <table style="width:100%;">
                  <tr>
                  <?php $date=time();?>
                 <td width="86"> 
                 	Ngày
                    <input type="text" name="ngay" value="<?php echo date('d',$date);?>" readonly="readonly" style="width:30px"/>
                 </td>
                 <td width="95">
                 Tháng
                 	<input type="text" name="thang" value="<?php echo date('m',$date);?>" readonly="readonly" style="width:30px"/>
                 </td>
                 <td width="100"> 
                 Năm
                    <input type="text" name="nam" value="<?php echo date('Y',$date);?>" readonly="readonly" style="width:30px"/>
                 </td>
                 <td width="192">
                  Ngày bắt đầu: 
                  
                    <strong>12/11/201</strong>
                 </td>
                 <td width="203">
                  Ngày kết thúc: 
                  
                  <strong>20/11/2012</strong>
                  </td></tr></table>
                  
                  </td>
                </tr>
                            
                <tr class="light" id="tieudeyeucau" onmouseover="mouse_den(this)" onmouseout="mouse_di(this)">
                  <td id="tieudeyeucau1" class="tdbg_2"><span><strong>Tiến độ dự án</strong><span class="color_khancap"></span></span></td>
                  <td id="tieudeyeucau2" class="tdbg_2">:</td>
                  <td id="tieudeyeucau3" class="tdbg_2">
                  <table width="520">
                   <?php 
						$baocao=mysql_query("select * from report where task_id='$id' and ngay='".date('d',time())."' order by report_id desc");
						$rsbaocao=mysql_fetch_array($baocao);
					?>
                  <tr>
                  	
                 	 <td>Trạng thái
                	<select name="trangthai">
                    	<option>--Chọn trạng thái-- </option>
                        <option value="1" <?php if($rsbaocao['trangthai']=='1'){?> selected="selected"<?php }?>>Chưa làm </option>
                        <option value="2" <?php if($rsbaocao['trangthai']=='2'){?> selected="selected"<?php }?>>Đang thực hiện </option>
                        <option value="3" <?php if($rsbaocao['trangthai']=='3'){?> selected="selected"<?php }?>>Đã hoàn thành </option>
                    </select>
                 </td>
              		<td width="301">Mức độ hoàn thành
                   
                        <select name="phantram" id="phantram"> 
                            <option value="">--Vui lòng chọn--</option> 
                            <option value="0%" style="color:#060;"<?php if($rsbaocao['phantram']=='0%'){?> selected="selected"<?php }?>>0%
                            </option>
                            <option value="10%" style="color:#060;"<?php if($rsbaocao['phantram']=='10%'){?> selected="selected"<?php }?>>10%
                            </option> 
                            <option value="20%" style="color:#060;"<?php if($rsbaocao['phantram']=='20%'){?> selected="selected"<?php }?> >20%
                            </option> 
                            <option value="30%" style="color:#060;"<?php if($rsbaocao['phantram']=='30%'){?> selected="selected"<?php }?>>30%
                            </option>
                            <option value="40%" style="color:#060;"<?php if($rsbaocao['phantram']=='40%'){?> selected="selected"<?php }?>>40%
                            </option>
                            <option value="50%" style="color:#060;"<?php if($rsbaocao['phantram']=='50%'){?> selected="selected"<?php }?>>50%
                            </option>
                            <option value="60%" style="color:#060;"<?php if($rsbaocao['phantram']=='60%'){?> selected="selected"<?php }?>>60%
                            </option>
                            <option value="70%" style="color:#060;"<?php if($rsbaocao['phantram']=='70%'){?> selected="selected"<?php }?>>70%
                            </option>
                            <option value="80%" style="color:#060;"<?php if($rsbaocao['phantram']=='80%'){?> selected="selected"<?php }?>>80%
                            </option>
                            <option value="90%" style="color:#060;"<?php if($rsbaocao['phantram']=='90%'){?> selected="selected"<?php }?>>90%
                            </option>
                            <option value="100%" style="color:#060;"<?php if($rsbaocao['phantram']=='100%'){?> selected="selected"<?php }?>>100%</option>
                           
                            
                        </select>
                  </td>
               
                  </tr>
                 </table>
                </td>
               
               </tr>
       
                <tr class="light" id="cauhoi" onmouseover="mouse_den(this)" onmouseout="mouse_di(this)" bgcolor="">
                  <td class="tdbg_2" id="cauhoi1">Ghi chú thêm<span class="color_khancap"></span></td>
                  <td class="tdbg_2" id="cauhoi2">:</td>
                  <td class="tdbg_2" id="cauhoi3">                     
                   	<div style="width:700px;">
					<textarea name="brief" id="txtnoidung" rows="15" cols="80" style="width: 80%"></textarea>  
                    </div>        
                </tr>
                <tr class="light" id="hinhanh" onmouseover="mouse_den(this)" onmouseout="mouse_di(this)">
                  <td class="tdbg_2" id="hinhanh1">File đính kèm nếu có<br>
                    (*.gif, *.jpg, *.png, .doc, .pdf &lt; &nbsp;5000Kb)</td>
                  <td class="tdbg_2" id="hinhanh2">:</td>
                   <td id="myDiv" class="tdbg_2">
							<div style="float:left; width:100%; margin-top:5px;">
								<input type="hidden" id="userfile1" name="sanpham_hinhanh1"  value="<?php  echo $arr_hinhanh[0]?>"/>
								<?php if($arr_hinhanh[0]==""){$sanpham_hinhanh="upload/hinhanh/photo.jpg";}else $sanpham_hinhanh = $arr_hinhanh[0];?>
								<img src="<?php  echo $sanpham_hinhanh?>" width="50" id="imgdef1" name="imgdef1" height="40" style="float:left; border:#CCC 1px solid" />
								
								<input type="button" name="button3" value="Up file đính kèm" onclick="JavaScript:window.open('Upfile.php?Dir=sanpham&amp;form=userfile1&img=imgdef1','_upLoad' ,'height=220,width=450,resizable=no,scrollbars=yes')") />
								
								<input type="hidden" value="<?php echo $soanh;?>" name="hdnsoanh" id="theValue" />
								<a href="javascript:;" onclick="addElement();">Thêm file đính kèm</a>
							</div>
							<?php
								for($i=2; $i<=$soanh;$i++){
								$hinhanh = $arr_hinhanh[$i-1];
							?>
								<div id="my<?php echo $i;?>Div" style="float:left; width:100%; margin-top:5px;">
									<input type="hidden" id="userfile<?php echo $i;?>" name="sanpham_hinhanh<?php echo $i;?>"  value="<?php  echo $hinhanh?>"/>
									<img src="<?php echo $hinhanh?>" width="50" id="imgdef<?php echo $i;?>" name="imgdef<?php echo $i;?>" height="40" style="float:left; border:#CCC 1px solid" />
								  
								   <input type="button" name="button3" value="Up file đính kèm" onclick="JavaScript:window.open('Upfile.php?Dir=sanpham&amp;form=userfile<?php echo $i;?>&img=imgdef<?php echo $i;?>','_upLoad' ,'height=220,width=450,resizable=no,scrollbars=yes')") />
								 
								   <a href="javascript:;" onclick="removeElement('my<?php echo $i;?>Div');">Delete</a>
								</div>
							<?php
								}
							?>
						   </td>
                </tr>
                <tr class="light" id="bonut" onmouseover="mouse_den(this)" onmouseout="mouse_di(this)">
                  <td class="tdbg_2" id="bonut1">&nbsp;</td>
                  <td class="tdbg_2" id="bonut2">&nbsp;</td>
                  <td class="tdbg_2" id="bonut3"><input class="buttonnew" name="submit" value="Gửi Báo Cáo" onclick="SelectAll('NGUOIXULY')" type="submit">
                    &nbsp;
                    <input name="Submit2" class="buttonnew" value="&nbsp;Làm lại&nbsp;" type="reset"></td>
                </tr>
              </tbody></table>
              <table border="0" cellpadding="0" cellspacing="0" height="10" width="100%">
                <tbody><tr class="light">
                  <td><img src="index2.php_files/spaces.gif" border="0" height="1" width="1"></td>
                </tr>
              </tbody></table>
            </form></td>
          <td class="c-r"></td>
        </tr>
        <tr class="light">
          <td class="b-l"></td>
          <td class="b-c"></td>
          <td class="b-r"></td>
        </tr>
      </tbody></table>